<?php
class HeaderNavigationForm extends Form{
	function HeaderNavigationForm(){
		Form::Form('HeaderManageNewsForm');	
	}
		
	function draw()
	{		
		if(CGlobal::$curCategory)
		{
			global $display;
			
			$parentNameCat 	= '';
			$curNameCat 	= '';
			
			
	        if(CGlobal::$allCategories[CGlobal::$curCategory]['parent_id'] && isset(CGlobal::$allCategories[CGlobal::$allCategories[CGlobal::$curCategory]['parent_id']]))//DM cấp 2
	        {
	        	$linkparentNameCat = WEB_ROOT."c".CGlobal::$allCategories[CGlobal::$curCategory]['parent_id']."/".CGlobal::$allCategories[CGlobal::$allCategories[CGlobal::$curCategory]['parent_id']]['ebname'];
	        	
	        	$parentNameCat = "<a href='".$linkparentNameCat."'>".CGlobal::$allCategories[CGlobal::$allCategories[CGlobal::$curCategory]['parent_id']]['name']."</a> <div class=\"node\"></div> ";
	        	
	            $ebname = CGlobal::$allCategories[CGlobal::$allCategories[CGlobal::$curCategory]['parent_id']]['ebname'].'-'.CGlobal::$allCategories[CGlobal::$curCategory]['ebname'];
	        }
	        else
	        {
	            $ebname 	= CGlobal::$allCategories[CGlobal::$curCategory]['ebname'];
	        }
	
	        if(isset(CGlobal::$allCategories[CGlobal::$curCategory]['name']))
	        {
				$linkCurNameCat = WEB_ROOT."c".CGlobal::$curCategory."/".$ebname;
				
				$curNameCat 	= "<a href='".$linkCurNameCat."' class='selected'>".CGlobal::$allCategories[CGlobal::$curCategory]['name']."</a>";
			}
			
			$page_no=(int)Url::get('page_no',1);
				
			if($page_no<=0){
				$page_no = 1;
			}
			
			$navigation = $parentNameCat . $curNameCat;
			
			if(AZNet::$page['name'] == 'list_detail')
			{
				$navigation .= ' <span style="color:#ccc;float:right;margin-top:3px">[ Trang '.$page_no.' ]</span>';
			}
			elseif(AZNet::$page['name'] == 'item_detail' && Item::$item && User::have_permit(ADMIN_ITEM))
			{
				$navigation .= '<span style="color:#c00;float:right;margin-top:3px">&raquo; ID SP ['.Item::$id.']</span>';
			}
			
			$display->add('url_home',WEB_DIR);				
			$display->add('navigation',$navigation);

			$display->output('HeaderNavigation');			
		}
	}
}
?>